{include file="head.html"}
<div id="maincontent">
  <div class="wrap">
    <div class="crumbs"> <a href="__APP__/index/home">{lang='系统设置'}</a> <a href="#">{lang='模块管理'}</a> </div>
    <hr /><br />
    <table class="list_table table_style">
      <thead>
        <tr>
            <th width="25%" align="center"><div style=" padding-left:30px;">{lang='模块名'}</div></th>
            <th width="25%" align="left">{lang='模块文件'}</th>
            <th width="15%" align="left">{lang='模块作者'}</th>
            <th width="15%" align="left">{lang='模块版本'}</th>
            <th width="20%"><div align="center">{lang='操作'}</div></th>
          </tr>
      </thead>
      <?php if (is_array($list)) foreach ($list as $vo) { ?>
        <?php
        $condition['FILE_NAME'] = $vo['FILE_NAME'];
        $module_list = module('common')->model->table('module')->where($condition)->select();
        if (!empty($module_list)) foreach ($module_list as $mod_vo) {
        ?>
        <tr>
          <td align="left"><div style=" padding-left:20px;">{$mod_vo['NAME']}</div></td>
          <td align="left">{$mod_vo['FILE_NAME']}</td>
          <td align="left">{$mod_vo['AUTHOR']}</td>
          <td align="left">{$mod_vo['VER']}</td>
          <td align="center">          
          <?php if($mod_vo['OPEN']) { ?>
          <a href="__URL__/switchoff-{$mod_vo['FILE_NAME']}">{lang='停用'}</a> |
          <?php }else{ ?>
          <a href="__URL__/switchon-{$mod_vo['FILE_NAME']}" style="color:#F00">{lang='启动'}</a> |
          <?php } ?>
          <?php if($vo['VER']>$mod_vo['VER']) { ?>
          <a href="#" style="color:#F00" onclick="update('{$mod_vo['FILE_NAME']}')">{lang='升级'}</a>
          <?php }else{ ?>
          <a href="#" onclick="uninstall('{$mod_vo['FILE_NAME']}')">{lang='卸载'}</a>
          <?php } ?>
          </td>
        </tr>
        
        <?php }else{ ?>
        
        <tr>
          <td align="left"><div style=" padding-left:20px;">{$vo['NAME']}</div></td>
          <td align="left">{$vo['FILE_NAME']}</td>
          <td align="left">{$vo['AUTHOR']}</td>
          <td align="left">{$vo['VER']}</td>
          <td align="center">
          <span style="color:#666">{lang='启用'}</span> |
          <a href="javascript:void(0)" onclick="install('{$vo['FILE_NAME']}')" style="color:#F00">{lang='安装'}</a>
          </td>
        </tr>
        
        <?php }} ?>
    </table>
  </div>
</div>
<script>
//卸载
function uninstall(file) {	

parent.asyncbox.confirm('{lang='确认要卸载该模块吗？'}','{lang='操作提示'}',function(action){
if(action == 'ok'){
	window.location.href="__URL__/uninstall-"+file;
   }
	
　});

}

//安装
function install(file) {	

parent.asyncbox.confirm('{lang='确认要安装该模块吗？'}','{lang='操作提示'}',function(action){
if(action == 'ok'){
	window.location.href="__URL__/install-"+file;

}
　});
	 
}

//升级
function update(file) {	

parent.asyncbox.confirm('{lang='确认要进行升级吗？'}','{lang='操作提示'}',function(action){
if(action == 'ok'){

	window.location.href="__URL__/update-"+file;

}
　});
	 
}

</script>
</body></html>